<?PHP
require_once("functions.php");
require_once("php-soundcloud/Soundcloud.php");
$userinfo = $session->userinfo;

if(is_not_null($_GET['mode'])) {

	$network = $_GET['mode'];
	// Retrieve mode, re-direct to authorize with designated network
	
	if(strcmp($network, "twitter") == 0) {
		$twitObj = new EpiTwitter($twitterConsumerKey, $twitterConsumerSecret);	
		$authUrl = $twitObj->getAuthenticateUrl();
		
		header("Location: ".$authUrl);
		exit;
	}
    
	if (strcmp($network, "myspace") == 0) {
		require_once("myspace.php");
		$myspace = new MyspaceNetwork();
		$myspace->authenticate();
	}
	
	if (strcmp($network, "soundcloud") == 0) {
		$soundcloud = new Services_Soundcloud($soundcloudConsumerKey, $soundcloudConsumerSecret, $soundcloudRedirectUri);
		$authUrl = $soundcloud->getAuthorizeUrl();
		
		header("Location: ".$authUrl);
		exit;
	}
} 

header("Location: profile/viewprofile.php");
exit;

?>